<?
/**
 * Categories Admin
 * Работа с категориями
 * Шаблон
 */
?>
<?php defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm">
<div id="editcell">
	<table class="adminlist">
	<tr>
		<td colspan="5" align="left">
                    Поиск: <input name="search" size="50" type="text" value="<?php if(isset($_POST['search'])) echo $_POST['search'];?>"/>
		</td>
		
	</tr>
	</table>
	<table class="adminlist">
	
	<thead>
		<tr>
			<th width="5">
				<?php echo JText::_( 'ID' ); ?>
			</th>
			<th width="20">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
			</th>			
			<th width="">
				<?php echo JText::_( 'Название' ); ?>
			</th>
                        <th width="100px">
				<?php echo JText::_( 'Товаров' ); ?>
			</th>
                        <th width="100px">
				<?php echo JText::_( 'Опубликовано' ); ?>
			</th>
                        <th width="200px">
				<?php echo JText::_( 'Неопубликовано' ); ?>
			</th>
                        <th width="100px">
				<?php echo JText::_( 'Нет на складе' ); ?>
			</th>
			<th width="100px">
				<?php echo JText::_( 'Порядок' ); ?>
			</th>
			<th width="200">
				<?php echo JText::_( 'Опубликовано' ); ?>
			</th>
			
		</tr>
	</thead>
	<?php
	$k = 0;
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)	{
		$row = &$this->items[$i];
		$checked 	= JHTML::_('grid.id',   $i, $row->id );
		$link 		= JRoute::_( 'index.php?option=com_shop&view=new_category&cid='. $row->id );

		?>
		<tr class="<?php echo "row$k"; ?>">
			<td align="center">
				<?php echo $row->id; ?>
			</td>
			<td align="center">
				<?php echo $checked; ?>
			</td>
			<td>
                            <a href="<?php echo $link; ?>"><?php echo $row->name; ?></a>
			</td>
                        <td align="center">
                            <a href="index.php?option=com_shop&view=goods&cat_id=<?=$row->id;?>">
                                <?=$row->oStat->total;?>
                            </a>
			</td>
                        <td align="center">
                            <?=$row->oStat->publish;?>
			</td>
                        <td align="center">
                            <? if($row->oStat->non_publish > 0) { ?><a
                                href="index.php?option=com_shop&view=goods&cat_id=<?=$row->id;?>&non_published=1"><? } ?>
                                <?=$row->oStat->non_publish;?><? if($row->oStat->non_publish > 0) { ?></a>:&nbsp;&nbsp;&nbsp;&nbsp;<a
href="index.php?option=com_shop&view=categories&publish_cat=<?=$row->id;?>">Опубликовать</a>
                            <? } ?>
                        </td>
                        <td align="center">
                            <?=$row->oStat->non_sklad;?>
			</td>
			<td class="order">
                            <span><?php echo $this->pagination->orderUpIcon($i); ?></span>
                            <span><?php echo $this->pagination->orderDownIcon($i, $n); ?></span>
                            <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>"  class="text_area" style="text-align:center" />
			</td>
			<td align="center">
				<?php if($row->published == 1) echo '<span style="color:green;font-size:12px;font-weight:bold;">Да</span>'; else echo '<span style="color:red;font-size:12px;font-weight:bold;">Нет</span>'?>
			</td>
			
		</tr>
		<?php
		$k = 1 - $k;
	}
	?>
	</table>
</div>

<input type="hidden" name="option" value="com_shop" />
<input type="hidden" name="view" value="categories"/>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />

</form>
